using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Standardize Field</para>
    /// <para>Standardizes values in fields by converting them to values that follow a specified scale. Standardization methods include z-score, minimum-maximum, absolute maximum, and robust standardization.</para>
    /// <para>通过将字段中的值转换为遵循指定比例的值来标准化字段中的值。标准化方法包括 z 分数、最小值-最大值、绝对最大值和稳健标准化。</para>
    /// </summary>    
    [DisplayName("Standardize Field")]
    public class StandardizeField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public StandardizeField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table containing the field with the values to be standardized.</para>
        /// <para>包含要标准化的值的字段的表。</para>
        /// </param>
        /// <param name="_fields">
        /// <para>Field to Standardize</para>
        /// <para>The fields containing the values to be standardized. For each field, an output field name can be specified. If an output field name is not provided, the tool will create an output field name using the field name and selected method.</para>
        /// <para>包含要标准化的值的字段。对于每个字段，可以指定输出字段名称。如果未提供输出字段名称，则该工具将使用字段名称和所选方法创建输出字段名称。</para>
        /// </param>
        public StandardizeField(object _in_table, object _fields)
        {
            this._in_table = _in_table;
            this._fields = _fields;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Standardize Field";

        public override string CallName => "management.StandardizeField";

        public override List<string> AcceptEnvironments => ["extent"];

        public override object[] ParameterInfo => [_in_table, _fields, _method.GetGPValue(), _min_value, _max_value, _updated_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table containing the field with the values to be standardized.</para>
        /// <para>包含要标准化的值的字段的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Field to Standardize</para>
        /// <para>The fields containing the values to be standardized. For each field, an output field name can be specified. If an output field name is not provided, the tool will create an output field name using the field name and selected method.</para>
        /// <para>包含要标准化的值的字段。对于每个字段，可以指定输出字段名称。如果未提供输出字段名称，则该工具将使用字段名称和所选方法创建输出字段名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field to Standardize")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _fields { get; set; }


        /// <summary>
        /// <para>Standardization Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method to use to standardize the values contained in the specified fields.</para>
        ///   <bulletList>
        ///     <bullet_item>Z-Score—The standard score, which is the number of standard deviations above or below the mean, is used. The calculation is the Z-Score formula, which calculates the difference between the value and the mean of the values in the column, divided by the standard deviation of the values in the column. This is the default.</bullet_item><para/>
        ///     <bullet_item>Minimum-maximum—The values are converted to a scale between the user-specified minimum and maximum values.</bullet_item><para/>
        ///     <bullet_item>Absolute maximum—Each value in the column is divided by the maximum absolute value in the column.</bullet_item><para/>
        ///     <bullet_item>Robust standardization— A robust variant of the Z-Score formula is used to standardize the values in the specified fields. This variant uses median and interquartile range in place of mean and standard deviation.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于标准化指定字段中包含的值的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>Z 分数—使用标准分数，即高于或低于平均值的标准差数。计算是 Z 分数公式，该公式计算列中值的值与平均值之间的差值除以列中值的标准差。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>最小值-最大值 - 将值转换为用户指定的最小值和最大值之间的刻度。</bullet_item><para/>
        ///     <bullet_item>绝对最大值 - 列中的每个值除以列中的最大绝对值。</bullet_item><para/>
        ///     <bullet_item>稳健的标准化 — Z 分数公式的稳健变体用于标准化指定字段中的值。该变体使用中位数和四分位距代替平均值和标准差。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Standardization Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _method_value _method { get; set; } = _method_value.value0;

        public enum _method_value
        {
            /// <summary>
            /// <para>Z-Score</para>
            /// <para>Z-Score—The standard score, which is the number of standard deviations above or below the mean, is used. The calculation is the Z-Score formula, which calculates the difference between the value and the mean of the values in the column, divided by the standard deviation of the values in the column. This is the default.</para>
            /// <para>Z 分数—使用标准分数，即高于或低于平均值的标准差数。计算是 Z 分数公式，该公式计算列中值的值与平均值之间的差值除以列中值的标准差。这是默认设置。</para>
            /// </summary>
            [Description("Z-Score")]
            [GPEnumValue("Z-SCORE")]
            value0,

            /// <summary>
            /// <para>Minimum-maximum</para>
            /// <para>Minimum-maximum—The values are converted to a scale between the user-specified minimum and maximum values.</para>
            /// <para>最小值-最大值 - 将值转换为用户指定的最小值和最大值之间的刻度。</para>
            /// </summary>
            [Description("Minimum-maximum")]
            [GPEnumValue("MIN-MAX")]
            value1,

            /// <summary>
            /// <para>Absolute maximum</para>
            /// <para>Absolute maximum—Each value in the column is divided by the maximum absolute value in the column.</para>
            /// <para>绝对最大值 - 列中的每个值除以列中的最大绝对值。</para>
            /// </summary>
            [Description("Absolute maximum")]
            [GPEnumValue("MAXABS")]
            _MAXABS,

            /// <summary>
            /// <para>Robust standardization</para>
            /// <para>Robust standardization— A robust variant of the Z-Score formula is used to standardize the values in the specified fields. This variant uses median and interquartile range in place of mean and standard deviation.</para>
            /// <para>稳健的标准化 — Z 分数公式的稳健变体用于标准化指定字段中的值。该变体使用中位数和四分位距代替平均值和标准差。</para>
            /// </summary>
            [Description("Robust standardization")]
            [GPEnumValue("ROBUST")]
            _ROBUST,

        }

        /// <summary>
        /// <para>Minimum Value</para>
        /// <para>The value used by the Minimum-maximum method of the Standardization Method parameter to specify the minimum value in the scale of the provided output values.</para>
        /// <para>标准化方法参数的最小值-最大值方法用于指定所提供输出值的刻度中的最小值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Value")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _min_value { get; set; } = 0;


        /// <summary>
        /// <para>Maximum Value</para>
        /// <para>The value used by the Minimum-maximum method of the Standardization Method parameter to specify the maximum value in the scale of the provided output values.</para>
        /// <para>标准化方法参数的最小值-最大值方法使用的值，用于指定所提供输出值的刻度中的最大值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Value")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _max_value { get; set; } = 1;


        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _updated_table { get; set; }


        public StandardizeField SetEnv(object extent = null)
        {
            base.SetEnv(extent: extent);
            return this;
        }

    }

}